package demo;

import jdk.jfr.Percentage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
@Component
@PropertySource("classpath:config.properties")
public class Person {

    @Qualifier("wear")
    private Clothes clothes;
    @Value("${Person.name}")
    String name;
    @Value("${Person.age}")
    int age;

    public Person() {
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return age
     */
    public int getAge() {
        return age;
    }

    /**
     * 设置
     * @param age
     */
    public void setAge(int age) {
        this.age = age;
    }
    @Override
    public String toString() {
        return "Person{name = " + name + ", age = " + age + "}";
    }
    public void sayHello(){
        System.out.println("hello world");
    }
    public void play(){
        clothes.wear();
        System.out.println("玩");
    }
}
